<?php

/**
 * Crc CMS
 *
 * @category   Crc
 * @package    Crc_Modules
 * @subpackage Index
 * @author     Moldovan Calin <mcalin45@gmail.com>
 * @author     Vlad Razvan <razvanvlad1982@yahoo.com>
 * @copyright  Copyright (c) 2012
 * @version    $Id: IndexController.php 61 2013-02-11 20:46:28Z mcalin45@gmail.com $
 */


/**
 * Index controller
 *
 * @category   Crc
 * @package    Crc_Modules
 * @subpackage Index
 * @author     Moldovan Calin <mcalin45@gmail.com>
 * @author     Vlad Razvan <razvanvlad1982@yahoo.com>
 * @copyright  Copyright (c) 2012
 */

class IndexController extends Zend_Controller_Action
{
    /**
     * @var Bisna\Application\Container\DoctrineContainer
     */
    protected $doctrine;

    /**
     * @var Doctrine\ORM\EntityManager
     */
    protected $entityManager;

    /**
     * @var Crc\Entity\RepositoryWaterTypeRepository
     */
    protected $waterTypeRepository;

    public function init()
    {
        $this->doctrine = Zend_Registry::get('doctrine');
        $this->entityManager = $this->doctrine->getEntityManager();
        $this->waterTypeRepository = $this->entityManager->getRepository('\Crc\Entity\WaterType');
    }
    /**
     * Default controller action
     *
     * @return void
     */
    public function indexAction()
    {
        //$puddle = $this->entityManager->getRepository('\Crc\Entity\Puddle')->find(1);
        //$waterType = $puddle->getWaterType();
        //Doctrine\Common\Util\Debug::dump($waterType);
        //Zend_Debug::dump($waterType->getName());
        //Zend_Debug::dump($waterType);
        //Doctrine\Common\Util\Debug::dump($waterType);
        //exit;
        //

        //
        //$waterType = $this->waterTypeRepository->find(1);
        //$waterType = new Crc\Entity\WaterType();
        //Zend_Debug::dump($waterType);
        //Doctrine\Common\Util\Debug::dump($waterType);
        //$entityManager = $this->getInvokeArg('bootstrap')->getResource('doctrine')->getEntityManager();
        //$waterType->setName('Test');
        //$entityManager->persist($waterType);
        //$entityManager->flush();
        //Zend_Debug::dump($entityManager);
        //exit;

        //$logger = Zend_Registry::get('log');
        //$logger->log('Debug message', Zend_Log::DEBUG);
    }
}